package publicroute

import (
	"github.com/RocksonZeta/irisx"
	"github.com/kataras/iris/v12"
)

//RouteUserApi /
func RouteIndex(party iris.Party) {
	party.Get("/", func(ctx iris.Context) {
		c := ctx.(*irisx.Context)
		c.View("index.html")
	})
	party.Get("/index", func(ctx iris.Context) {
		c := ctx.(*irisx.Context)
		c.View("index.html")
	})
	party.Get("/signin", func(ctx iris.Context) {
		c := ctx.(*irisx.Context)
		c.View("public/signin.html")
	})
	party.Post("/signin", func(ctx iris.Context) {
		c := ctx.(*irisx.Context)
		// var param users.SigninParam
		// param.Email = c.CheckBody("email").NotBlank().String()
		// param.Password = c.CheckBody("password").NotBlank().String()
		// routes.Check(c)
		// up, err := users.UserPrivates{}.Signin(param)
		// if err != nil {
		// 	panic(err)
		// }
		// c.Session().SetUid(up.Uid)
		// c.Ok(up)
		c.Ok("")
	})
	party.Get("/signup", func(ctx iris.Context) {
		c := ctx.(*irisx.Context)
		c.View("public/signup.html")
	})
}
